package mk.timska_rabota_android;

import java.util.ArrayList;

import mk.timska_rabota_android.contacts.Contact;
import mk.timska_rabota_android.contacts.ContactsModule;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.Adapter;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.Toast;
public class ListContacts extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_list_contacts);
		ListView lista = (ListView)findViewById(R.id.ContactList);
		
		/*
		 * Dummy contacts
		 * */
		ArrayList<Contact> contacts = ContactsModule.getMyContacts();
		ArrayList<String> contactListStrings = ContactsModule.contactsToStrings(contacts);
		
		ArrayAdapter adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, contactListStrings);
		lista.setAdapter(adapter);
		adapter.notifyDataSetChanged();
		
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.list_contacts, menu);
		return true;
	}

}
